# 用户结构
Users = {
    "小红":{"password": "123", "status": True},
    "jack":{"password": "456", "status": True},
    "user1":{"password": "123456", "status": False},
}

# 功能选择
flag = True
while flag:
    key = eval(input("当前业务内容：\n1.注册账户\n2.登录账户\n3.显示当前用户\n4.退出\n请输入业务内容："))
    # 注册逻辑
    if key == 1:
        for i in range(3):
            user = input("请输入您的用户名：")
            pwd = input("请输入您的密码：")

            if user in Users:
                print("用户名被占用!请重新注册!")
            else:
                Users[user] = {"password":pwd,"status":True}
                break

    # 登录逻辑
    elif key ==2:
        for i in range(3):
            # 信息收集
            user = input("请输入您的用户名：")
            pwd = input("请输入您的密码：")

            # 逻辑判断
            if user in Users and pwd == Users[user]["password"]:
                connected_user = Users[user]
                if connected_user['status']:
                    print("登录成功")
                    flag = False
                    break
                else:
                    print("账户失效，请联系管理员!")
            else:
                print("账户不存在或者密码错误!")
        flag = False

    # 查看当前账户
    elif key ==3:
        print(Users)

    # 退出
    elif key ==4:
        print("已退出!")
        flag = False
    else:
        print("错误！要求无法理解")